* Clean up
clear all

/* Set working directory: please set your own
cd "~/Dropbox/JOP third submission/JOP replication/"
*/

* Open dataset
use 01_data/elections_ciutadella.dta, clear

* 2014/5-2019
reghdfe pp_voteshare post##ep  if period > 1 , absorb(table_code_electionspecific) cluster(table_code_electionspecific)
est store twoperiods

* Pre vs. post
reghdfe pp_voteshare post##ep, absorb(table_code_electionspecific) cluster(table_code_electionspecific)
est store prepost

* Fixed effects for each period
reghdfe pp_voteshare post##ep i.period, absorb(table_code_electionspecific) cluster(table_code_electionspecific)
est store threeperiods

* 2009/11-2014/5 (Placebo)
reghdfe pp_voteshare_lag post##ep, absorb(table_code_electionspecific) cluster(table_code_electionspecific)
est store placebo

* Make table
esttab twoperiods prepost threeperiods placebo using 03_tables/tabled11.tex, tex se replace mtitles ("2014-2019" "2009-2019" "2009-2019" "Placebo with lagged outcome")  keep (1.post 1.post#1.ep 2.period) coeflabels (1.post#1.ep "Treatment (absence of booth)" 1.post "2019" 2.period "2014-5") star(* 0.10 ** 0.05 *** 0.01) addnotes("All models include voting station * election type fixed effects" "Standard errors are clustered by voting station * election type")
